﻿//****************************************************************************************************
//Author:          Jun Wang
//Guid:		       6b21b59a-9cac-4932-a456-32c3033060fe
//DateTime:        3/4/2013 1:04:55 PM
//Email Address:   edu-wangjun@gedu.org
//FileName:        LibVlcMediaListPlayerInterop
//CLR Version:     4.0.30319.18033
//Machine Name:    META-DESKTOP
//Namespace:       RuanRang.Media.Core.Internal.Interop
//Function:                
//Description:    
//****************************************************************************************************
using System;
using System.Runtime.InteropServices;
using System.Security;
using RuanRang.Media.Core.Internal.DataStructures;
using log4net;

namespace RuanRang.Media.Core.Internal.Interop
{
    internal class LibVlcMediaListPlayerInterop : BaseInterop
    {
        /// <summary>
        /// Initializes the <see cref="LibVlcMediaListPlayerInterop" /> class.
        /// </summary>
        static LibVlcMediaListPlayerInterop()
        {
            Logger = LogManager.GetLogger(typeof(LibVlcMediaListPlayerInterop));
        }

        /// <summary>
        /// Create new media list player.
        /// </summary>
        /// <param name="vlcInstance">Libvlc instance.</param>
        /// <returns>Media list player instance or NULL on error.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_new", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern IntPtr libvlc_media_list_player_new(IntPtr vlcInstance);

        /// <summary>
        /// Release media list player created with NewInstance().
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_release", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_release(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Retain reference to a media list player.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_retain", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_retain(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Get libvlc event manager from this media list player instance.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <returns>The event manager associated with mediaListInstance.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_event_manager", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern IntPtr libvlc_media_list_player_event_manager(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Replace media player in media_list_player with this instance.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <param name="mediaPlayerInstance">The media player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_set_media_player", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_set_media_player(IntPtr mediaListPlayerInstance, IntPtr mediaPlayerInstance);

        /// <summary>
        /// Set the media list associated with the player.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <param name="mediaListInstance">The media list instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_set_media_list", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_set_media_list(IntPtr mediaListPlayerInstance, IntPtr mediaListInstance);

        /// <summary>
        /// Play media list.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_play", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_play(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Pause media list.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_pause", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_pause(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Is media list playing?
        /// </summary>
        /// 
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_is_playing", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_is_playing(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Get current state of media list player.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <returns>The current state of the media player (playing, paused, ...)</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_get_state", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern libvlc_state_t libvlc_media_list_player_get_state(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Play media list item at position index.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <param name="index">Index in media list to play.</param>
        /// <returns>0 upon success -1 if the item wasn't found.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_play_item_at_index", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_play_item_at_index(IntPtr mediaListPlayerInstance, int index);

        /// <summary>
        /// Play the given media item.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <param name="mediaInstance">Media instance to play.</param>
        /// <returns>0 upon success, -1 if the media is not part of the media list.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_play_item", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_play_item(IntPtr mediaListPlayerInstance, IntPtr mediaInstance);

        /// <summary>
        /// Stop media list.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_stop", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern void libvlc_media_list_player_stop(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Play next item from media list.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <returns>0 upon success -1 if there is no next item.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_next", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_next(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Play previous item from media list.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <returns>0 upon success -1 if there is no previous item.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_previous", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_previous(IntPtr mediaListPlayerInstance);

        /// <summary>
        /// Sets the playback mode for the playlist.
        /// </summary>
        /// <param name="mediaListPlayerInstance">The media list player instance.</param>
        /// <param name="mode">The playback mode specification.</param>
        /// <returns>0 upon success -1 if there is no previous item.</returns>
        [DllImport("libvlc", ExactSpelling = true, EntryPoint = "libvlc_media_list_player_set_playback_mode", CallingConvention = CallingConvention.Cdecl)]
        [SuppressUnmanagedCodeSecurity]
        public static extern int libvlc_media_list_player_set_playback_mode(IntPtr mediaListPlayerInstance, libvlc_playback_mode_t mode);
     
    }
}
